<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class SysConfig extends Model
{
    protected $table = 'sys_configs';


    protected $appends = [
        'file_list' ,
    ];

    public function getFileListAttribute()
    {
        if($this->type != '1') {
            return File::getFile($this->value);
        }
        return '';
    }

    public static function getValue($var) {
        $list = SysConfig::where("varname",$var)->first();
        if($list["type"] != 1) {
            $file = File::getFile($list["value"]);
            $list["value"] = $file->uri;
        }
        return $list["value"];
    }



}
